<template>
  <div>
  <div class="music-banner">
    <img src="../../assets/forum_header36.jpg" alt="" width="100%">
  </div>

  <div class="music-wrapper">
    <div class="music-category">
      <ul>
        <a href="?tag="><li class="category-item ">全部 </li></a>
        <a href="?tag=zy"><li class="category-item ">治愈 <span >55</span></li></a>
        <a href="?tag=rx"><li class="category-item ">燃向</li></a>
        <a href="?tag=love"><li class="category-item ">恋爱</li></a>
        <a href="?tag=sad"><li class="category-item ">悲伤</li></a>
        <a href="?tag=cyy"><li class="category-item ">纯音乐</li></a>
        <a href="?tag=code"><li class="category-item ">代码</li></a>
      </ul>
    </div>
    <musicItem :musicListData="MusicList.data"></musicItem>

  </div>
  </div>
</template>

<script>
    import musicItem from  '../../components/music/musicItem.vue'
    import Mock from 'mockjs';
    const ERROR = 0;
    export default {
      data() {
        return {
          MusicList: {}
        }
      },
      created() {
        window.addEventListener('scroll', this.waterfull);
        this.$http.get('http://rapapi.org/mockjs/17725/api/music?accessToken=sss').then((response) => {
          response = response.body;
          if (Mock.mock(response).errno === ERROR) {
            this.MusicList = Mock.mock(response);
            console.log(this.MusicList)
          }

        });
      },
        components:{
          musicItem
        }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss" rel="stylesheet/scss">
  .music-banner{
    border: 4px solid #d5d5d5;
    width: 1152px;
    height: 392px;
    margin: 0 auto;
    overflow: hidden;

    margin-bottom: 20px;
  }

  .music-wrapper{
    width: 1160px;
    margin: 0 auto;
    background-color: rgba(200,200,200,0.2);
    padding-top: 20px;
    position: relative;
    padding-bottom: 50px;
    .music-category{
      width: 100%;
      height: 28px;
      background: #FFFFFF;
      a{
        color: #222222;
      }
      .category-item{
        cursor: pointer;
        background: #FFFFFF;
        float: left;
        height: 28px;
        border: 2px solid #68CFF0;
        font-size: 12px;
        text-align: center;
        line-height: 28px;
        padding: 0 10px 0 10px;
        margin-right: 10px;
        span{
          background: #68CFF0;
          padding: 2px 4px 2px 4px;
          font-size: 12px;
        }
      }
      .active{
        background: #68CFF0;
      }
    }
  }

  .pageturn .pagelist {
    display: table-cell;
    vertical-align: middle;
    overflow: hidden;
    position: absolute;
    bottom: 0;
    right: 0;
  }

  .pageturn li {
    width: 30px;
    height: 30px;
    line-height: 30px;
    margin-left: 10px;
    float: left;
    text-align: center;
  }

  .pageturn li:first-child {
    margin-left: 0;
  }

  .pageturn li:hover a, .pageturn .active a {
    background: #717171;
    color: #fff;
    border-color: #eaeaea;
  }

  .pageturn a {
    border: 1px solid #eaeaea;
    display: block;
    height: 28px;
    color: #6c6c6c;
  }

  .pageturn .long {
    width: 100px;
  }

  .pageturn .none a {
    border: 0;
  }

  .pageright {
    float: right;
    width: auto;
    display: inline;
    clear: none;
    margin-top: 10px;
  }

</style>
